<%@ Page Language="C#" MasterPageFile="~/Employee.master" AutoEventWireup="true" CodeFile="ViewDeliveries.aspx.cs" Inherits="Pages_Employee_ManageDeliveries_ViewDeliveries" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="View Deliveries" CssClass="header"></asp:Label><br />
    <br />
    <br />
    <table>
        <tr>
            <td>Search Delivery:</td>
            <td>
                <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
                <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="ID must be a positive integer" ControlToValidate="txtSearch" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <asp:RadioButton ID="rdDeliverableID" runat="server" Checked="True" GroupName="GroupSearch" Text="Deliverable ID" />&nbsp&nbsp
                <asp:RadioButton ID="rdCustomerID" runat="server" GroupName="GroupSearch" Text="Customer ID" />
            </td>
        </tr>
    </table>
    <br />
    <asp:Label ID="lblMessage" runat="server"></asp:Label>
    <br />
    <br />
    <asp:GridView ID="gvDeliverables" runat="server" AutoGenerateColumns="False" DataSourceID="deliverablesDataSource" HeaderStyle-CssClass="smallheader" HeaderStyle-BackColor="#a9c0f2" BorderColor="#556CB0" GridLines="Vertical" Width="560px" AllowPaging="True" OnPageIndexChanging="gvDeliverables_PageIndexChanging">
        <HeaderStyle HorizontalAlign="Center" BackColor="#A9C0F2" CssClass="smallheader" />
        <AlternatingRowStyle BackColor="Gainsboro" />
        <Columns>
            <asp:BoundField DataField="DeliverableID" HeaderText="ID" SortExpression="DeliverableID" />
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
            <asp:BoundField DataField="ServiceName" HeaderText="Service" SortExpression="ServiceName" />
            <asp:BoundField DataField="Distance" HeaderText="Distance" SortExpression="Distance" />
            <asp:BoundField DataField="Weight" HeaderText="Wt." SortExpression="Weight" />
            <asp:BoundField DataField="CustomerID" HeaderText="Cust. ID" SortExpression="CustomerID" />
            <asp:BoundField DataField="ReceiverName" HeaderText="Receiver" SortExpression="ReceiverName" />
            <asp:BoundField DataField="ReceiverAddress" HeaderText="Address" SortExpression="ReceiverAddress" />
            <asp:BoundField DataField="ReceiverCity" HeaderText="City" SortExpression="ReceiverCity" />
            <asp:CheckBoxField DataField="Status" HeaderText="Status" SortExpression="Status" />
            <asp:HyperLinkField DataNavigateUrlFields="DeliverableID" DataNavigateUrlFormatString="~/Pages_Employee/ManageDeliveries/EditDelivery.aspx?id={0}"
                HeaderText="Edit" Text="Edit" />
            <asp:TemplateField HeaderText="Select">
                <ItemTemplate>
                    <asp:CheckBox ID="cboDelete" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <RowStyle HorizontalAlign="Center" />
    </asp:GridView>
    <asp:ObjectDataSource ID="deliverablesDataSource" runat="server" SelectMethod="GetDeliverables"
        TypeName="DALDeliverable" OldValuesParameterFormatString="original_{0}"></asp:ObjectDataSource>
    <br />
    <asp:Button ID="btnAddDelivery" runat="server" Text="Add new delivery" OnClick="btnAddDelivery_Click"/>&nbsp;
    <asp:Button ID="btnDeleteDelivery" runat="server" Text="Delete selected deliveries" CausesValidation="False" OnClientClick="return confirm('Are you sure you want to delete selected item(s) ?')" OnClick="btnDeleteDelivery_Click" />
</asp:Content>
